//
//  TopView.m
//  MPlayer
//
//  Created by 王俊 on 15/12/15.
//  Copyright © 2015年 王俊. All rights reserved.
//

#import "TopView.h"
#import "masonry.h"
#import "SongInfo.h"
#import "defines.h"
@interface TopView()
@property(nonatomic,strong) UILabel  *singerNameTitle;
@property(nonatomic,strong) UILabel  *songNameTitle;
@end

@implementation TopView

- (instancetype)initWithSongInfo:(SongInfo*)info
{
    if (self = [super init]) {
        self.backgroundColor = RGB(196, 44, 44);
        _singerNameTitle = [[UILabel alloc]init];
        _songNameTitle = [[UILabel alloc]init];
        [self configLabel:_singerNameTitle andText:info.singerName andFontSize:11];
        [self configLabel:_songNameTitle andText:info.songName andFontSize:18];
        [self addSubview:_singerNameTitle];
        [self addSubview:_songNameTitle];
        [_songNameTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(30);
            make.center.equalTo(self);
        }];
        [_singerNameTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(20);
            make.centerX.equalTo(_songNameTitle);
            make.top.equalTo(_songNameTitle.mas_bottom);
        }];
    }
    return self;
}

- (void)configLabel:(UILabel*)label andText:(NSString*) text andFontSize:(CGFloat) size
{
    label.textColor = [UIColor whiteColor];
    label.text = text;
    label.textAlignment = NSTextAlignmentCenter;
    label.font = [UIFont systemFontOfSize:size];
}

@end
